package www.yingdi365.com.viewholder;

import android.content.Intent;
import android.support.annotation.LayoutRes;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.jude.easyrecyclerview.adapter.BaseViewHolder;

import www.yingdi365.com.R;
import www.yingdi365.com.activity.HeKaActivity;
import www.yingdi365.com.activity.QingJianActivity;
import www.yingdi365.com.activity.ZaZhiActivity;

/**
 * Created by Administrator on 2017/3/28 0028.
 */
public class ShouYeViewHolder extends BaseViewHolder<Integer> {

    private final ImageView imageShouYe;

    public ShouYeViewHolder(ViewGroup parent, @LayoutRes int res) {
        super(parent, res);
        imageShouYe = $(R.id.imageShouYe);
    }

    @Override
    public void setData(Integer data) {
        super.setData(data);
        switch (data) {
            case 1:
                imageShouYe.setImageResource(R.mipmap.qingjian);
                imageShouYe.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        Intent intent = new Intent();
                        intent.setClass(getContext(), QingJianActivity.class);
                        getContext().startActivity(intent);
                    }
                });
                break;
            case 2:
                imageShouYe.setImageResource(R.mipmap.zazhi);
                imageShouYe.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        Intent intent = new Intent();
                        intent.setClass(getContext(), ZaZhiActivity.class);
                        getContext().startActivity(intent);
                    }
                });
                break;
            case 3:
                imageShouYe.setImageResource(R.mipmap.heka);
                imageShouYe.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        Intent intent = new Intent();
                        intent.setClass(getContext(), HeKaActivity.class);
                        getContext().startActivity(intent);
                    }
                });
                break;
            case 4:
                imageShouYe.setImageResource(R.mipmap.sheji);
                imageShouYe.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        Intent intent = new Intent();
                        intent.setClass(getContext(), ZaZhiActivity.class);
                        getContext().startActivity(intent);
                    }
                });
                break;
        }
    }

}
